package com.moon.common.utils.criteria;

public class Expression {
	
    /**
     * 传入的属性名,有格式要求
     * (前缀_匹配条件_类类型_andOr条件_字段名)
     * (eg:prefix_EQ_L_A_id)
     */
    private String propertyName;
    /**
     * 对象中的属性名或属性中的二级属性(eg:user.id)
     */
    private String fieldName;
    /**
     * 传入的值
     */
    private Object value;
    
    public String getPropertyName() {
		return propertyName;
	}
	
	public void setPropertyName(String propertyName) {
		this.propertyName = propertyName;
	}
	
	public String getFieldName() {
		return fieldName;
	}
	
	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}
	
	public Object getValue() {
		return value;
	}
	
	public void setValue(Object value) {
		this.value = value;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(!(obj instanceof Expression))return false;
		Expression other = (Expression) obj;
		if(other.propertyName.equals(this.propertyName) 
				&& other.value.equals(this.value)){
			return true;
		}
		return super.equals(obj);
	}
	
	@Override
	public int hashCode() {
		return this.propertyName.hashCode()+this.value.hashCode();
	}
	
}
